<template>
  <div>
    <ul>
      <li>
        <van-card
          v-for="(item, index) in list"
          :key="index"
          :price="item.price"
          :desc="item.desc"
          :title="item.title"
          :thumb="item.houseImg"
        >
          <template #tags>
            <van-tag plain type="danger">{{ item.tags }}</van-tag>
          </template>
        </van-card>
      </li>
    </ul>
  </div>
</template>

<script>
import { zhaofang } from '@/api/zhangfang'
export default {
  name: 'FangCard',
  data () {
    return {
      list: []
    }
  },
  methods: {
    async GetFangList () {
      console.log('ok')
      const res = await zhaofang()
      console.log('res', res)
      this.list = res.body.list
      console.log(res)
      for (let i = 0; i < this.list.length; i++) {
        this.list[
          i
        ].houseImg = `http://124.223.73.204:8080${this.list[i].houseImg}`
      }
      console.log(this.list)
    }
  },
  mounted () {
    this.GetFangList()
  }
}
</script>

<style scoped lang='less'></style>
